Ext.define('KaoQinCheckView', {
	extend : 'Ext.panel.Panel',
	id : 'KaoQinCheckView',
	title : '缺勤学生落实',
	region : 'center',
	layout : 'border',
	iconCls: 'menu-cusLinkman',

	initComponent : function() {		
		this.gridPanel = new KE.GridPanel({
			region : 'center',
			id: 'KaoQinCheckGrid',
			exportable : true,
			exportCfg : {
				expSel : true,
				selId : 'oid',
				selUrl : __ctxPath + "/xskq/exportSelKaoQin.do",
				execl : true,
				pdf : false
			},
			url : __ctxPath + "/xskq/listMyKaoQin.do",
			sorters: [{
				property: 'jieciType.dicId',
				direction: 'ASC'
			}, {
				property: 'student.oid',
				direction: 'ASC'
			}],
			fields : ['oid', 'check', {
						name : 'student.grade.name',
						mapping : 'student.grade.name'
					}, {
						name : 'course.name',
						mapping : 'course.name'
					}, {
						name : 'student.clazz.name',
						mapping : 'student.clazz.name'
					}, {
						name : 'jieciType.itemValue',
						mapping : 'jieciType.itemValue'
					}, {
						name : 'teacher.fullname',
						mapping : 'teacher.fullname'
					}, {
						name : 'student.name',
						mapping : 'student.name'
					}, {
						name : 'user.fullname',
						mapping : 'user.fullname'
					}, {
						name : 'type.itemValue',
						mapping : 'type.itemValue'
					}],
			columns : [{
						header : 'ID',
						dataIndex : 'oid',
						hidden : true
					}, {
						header : '年级',
						dataIndex : 'student.grade.name'
					}, {
						header : '班级',
						dataIndex : 'student.clazz.name'
					}, {
						header : '节次',
						dataIndex : 'jieciType.itemValue'
					}, {
						header : '课程',
						dataIndex : 'course.name'
					}, {
						header : '教师',
						dataIndex : 'teacher.fullname'
					}, {
						header : '学生',
						dataIndex : 'student.name'
					}, {
						header : '缺勤类型',
						dataIndex : 'type.itemValue'
					}, {
						header : '落实情况',
						dataIndex : 'check',
						renderer: function(v) {
							if(v==0) {
								return '<span class="bg-red">未落实</span>';
							} else if(v==1) {
								return '<span class="bg-green">已落实</span>';
							}
						}
					}]
		
		});

		this.items = [this.gridPanel];
		this.callParent();
		this.gridPanel.on('rowdblclick', this.rowClick);
	},
	// 重置查询表单
	reset : function() {
		this.searchPanel.getForm().reset();
		Ext.each(this.searchPanel.query('combo'), function(c) {
			c.setValue('');
			c.setRawValue('');
		});
	},
	// 按条件搜索
	search : function() {
		$search({
			searchPanel : this.searchPanel,
			gridPanel : this.gridPanel
		});
	},
	// GridPanel行点击处理事件
	rowClick : function(grid, rec) {
		new KaoQinCheckForm({
			rec: rec.data,
			sid : rec.data.oid
		}).show();
	}

});
